/**
 *@author lk
 *@date 2022/4/22 20:26 
 */
package com.xuecheng.manage_cms.controller;

import com.xuecheng.api.cms.CmsPageControllerApi;
import com.xuecheng.framework.domain.cms.CmsPage;
import com.xuecheng.framework.domain.cms.request.QueryPageRequest;
import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.framework.model.response.QueryResponseResult;
import com.xuecheng.framework.model.response.QueryResult;
import com.xuecheng.manage_cms.service.CmsPageService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/cms/page")
public class CmsPageController implements CmsPageControllerApi {

    @Autowired
    CmsPageService cmsPageService;

    @Override
    @GetMapping("/list/{page}/{size}")

    public QueryResponseResult findList(@PathVariable("page") int page, @PathVariable("size") int size, QueryPageRequest queryPageRequest) {
        return cmsPageService.findAll(page, size, queryPageRequest);


//        CmsPage cmsPage = new CmsPage();
//        List<CmsPage> pageList = new ArrayList<>();
//        QueryResult<CmsPage> cmsPageQueryResult = new QueryResult<>();
//
//        cmsPage.setPageName("测试页面");
//
//        pageList.add(cmsPage);
//
//        cmsPageQueryResult.setList(pageList);
//        cmsPageQueryResult.setTotal(1);
//
//        QueryResponseResult result = new QueryResponseResult(CommonCode.SUCCESS, cmsPageQueryResult);
//        return result;
    }
}
